6e634cc2d82305fe565db7d5f915387c3a765ba1,src/test/java/org/inferred/freebuilder/processor/SetPropertyFactoryTest.java,SetPropertyFactoryTest,testOverridingAdd_primitive,#,657
Before Change
@Test
public void testOverridingAdd_primitive() {
behaviorTester
.with(new Processor(features))
.with(new SourceBuilder()
.addLine("package com.example;")
.addLine("@%s", FreeBuilder.class)
.addLine("public abstract class DataType {")
.addLine(" public abstract %s<Integer> getItems();", Set.class)
.addLine("")
.addLine(" public static class Builder extends DataType_Builder {")
.addLine(" @Override public Builder addItems(int unused) {")
.addLine(" return this;")
.addLine(" }")
.addLine(" }")
.addLine(" public static Builder builder() {")
.addLine(" return new Builder();")
.addLine(" }")
.addLine("}")
.build())
.with(new TestBuilder()
.addLine("com.example.DataType value = new com.example.DataType.Builder()")
.addLine(" .addItems(0)", ImmutableList.class)
.addLine(" .addItems(1, 2)", ImmutableList.class)
.addLine(" .addAllItems(%s.of(3, 4))", ImmutableList.class)
.addLine(" .build();")
.addLine("assertThat(value.getItems()).isEmpty();")
.build())
.runTest();
}
@Test
After Change
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage(STRING_VALIDATION_ERROR_MESSAGE);
behaviorTester
.with(new Processor(features))
.with(VALIDATED_STRINGS)
.with(new TestBuilder()
.addLine("new com.example.DataType.Builder().addAllItems(%s.of(\"three\", \"\"));",
ImmutableList.class)
.build())
.runTest();
}
@Test